package byx.container.annotation.ExtensionTest;

import byx.container.annotation.extension.core.ParameterHandler;
import byx.container.annotation.extension.core.ParameterInfo;
import byx.container.annotation.annotation.Order;
import byx.container.core.Container;
import byx.container.core.ObjectFactory;

import static byx.container.core.ObjectFactories.*;

@Order(-1)
public class MyParameterHandler implements ParameterHandler {
    @Override
    public boolean support(ParameterInfo param) {
        return param.getAnnotationMetadata().isAnnotationPresent(Str.class);
    }

    @Override
    public ObjectFactory<?> handle(ParameterInfo param, Container container) {
        return value(param.getAnnotationMetadata().getAnnotation(Str.class).value());
    }
}
